/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.wpi.first.wpilibj.templates.tshirtcannon;

/**
 * The state for pressurizing the compressor half of the system.
 * @see TShirtCannon
 * @see TShirtCannonState
 */
class PressurizingState extends TShirtCannonState {
    private static PressurizingState m_instance = new PressurizingState();

    private PressurizingState() {
    }

    /**
     * enter is called when the t-shirt cannon enters this state.
     * @param tsc The t-shirt cannon.
     */
    void enter(TShirtCannon tsc) {
        tsc.setCompressorState(true);
        tsc.setFillValveState(false);
        tsc.setDumpValveState(true);
        tsc.setFireValve1State(false);
        tsc.setFireValve2State(false);
        tsc.setLightState(false);
    }

    /**
     * update is called when something calls the t-shirt cannon's update
     * function and this is the current state.
     * @param tsc The t-shirt cannon.
     */
    void update(TShirtCannon tsc) {
        if (tsc.getLeftStick().getRawButton(11) || tsc.getRightStick().getRawButton(11)
            || tsc.getGigaware().getRawButton(3)
            || tsc.getPressureSwitchState()) {
            tsc.changeState(PressurizedState.instance());
        }
        super.update(tsc);
    }

    /**
     * exit is called when the t-shirt cannon enters this state.
     * @param tsc The t-shirt cannon.
     */
    void exit(TShirtCannon tsc) {
    }

    /**
     * getName is called to get the name of this state.
     * @return The name of this state.
     */
    String getName() {
        return "Pressurizing";
    }

    /**
     * Returns the instance of this state.
     * @return The instance of this state.
     */
    static PressurizingState instance() {
        return m_instance;
    }
}
